import {
	Debounce
} from './index.js'

function prePage() {
	let pages = getCurrentPages();
	let prePage = pages[pages.length - 1];
	// #ifndef APP-PLUS
	return prePage.route;
	// #endif
	// #ifdef APP-PLUS
	return prePage.$page.fullPath;
	// #endif
}


export const toLogin = Debounce(_toLogin, 800)

function _toLogin(push) {
	let url = '/pages/users/login/index'
	uni.navigateTo({
		url
	})
}


export function checkLogin() {
	//  获取token
	let token = uni.getStorageInfoSync('user').token;
	if (!token) {
		uni.setStorageSync('authIng', false)
		uni.removeStorageSync('TOKEN')
		uni.removeStorageSync('USER_INFO')
		return false;
	} else {
		return true;
	}

}